.class public Lcom/qiniu/resumableio/PutRet;
.super Ljava/lang/Object;
.source "PutRet.java"


# instance fields
.field public checksum:Ljava/lang/String;

.field public crc32:J

.field public ctx:Ljava/lang/String;

.field public host:Ljava/lang/String;

.field public offset:I


# direct methods
.method public constructor <init>()V
    .registers 2

    .prologue
    .line 15
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    .line 11
    const/4 v0, 0x0

    iput v0, p0, Lcom/qiniu/resumableio/PutRet;->offset:I

    .line 15
    return-void
.end method

.method public constructor <init>(Lorg/json/JSONObject;)V
    .registers 3
    .param p1, "obj"    # Lorg/json/JSONObject;

    .prologue
    .line 16
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    .line 11
    const/4 v0, 0x0

    iput v0, p0, Lcom/qiniu/resumableio/PutRet;->offset:I

    .line 16
    invoke-virtual {p0, p1}, Lcom/qiniu/resumableio/PutRet;->parse(Lorg/json/JSONObject;)Lcom/qiniu/resumableio/PutRet;

    return-void
.end method


# virtual methods
.method public isInvalid()Z
    .registers 2

    .prologue
    .line 13
    iget-object v0, p0, Lcom/qiniu/resumableio/PutRet;->ctx:Ljava/lang/String;

    if-eqz v0, :cond_8

    iget v0, p0, Lcom/qiniu/resumableio/PutRet;->offset:I

    if-nez v0, :cond_a

    :cond_8
    const/4 v0, 0x1

    :goto_9
    return v0

    :cond_a
    const/4 v0, 0x0

    goto :goto_9
.end method

.method public parse(Lorg/json/JSONObject;)Lcom/qiniu/resumableio/PutRet;
    .registers 4
    .param p1, "obj"    # Lorg/json/JSONObject;

    .prologue
    .line 18
    const-string v0, "ctx"

    const-string v1, ""

    invoke-virtual {p1, v0, v1}, Lorg/json/JSONObject;->optString(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;

    move-result-object v0

    iput-object v0, p0, Lcom/qiniu/resumableio/PutRet;->ctx:Ljava/lang/String;

    .line 19
    const-string v0, "host"

    const-string v1, ""

    invoke-virtual {p1, v0, v1}, Lorg/json/JSONObject;->optString(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;

    move-result-object v0

    iput-object v0, p0, Lcom/qiniu/resumableio/PutRet;->host:Ljava/lang/String;

    .line 20
    const-string v0, "crc32"

    const-string v1, "0"

    invoke-virtual {p1, v0, v1}, Lorg/json/JSONObject;->optString(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;

    move-result-object v0

    invoke-static {v0}, Ljava/lang/Long;->valueOf(Ljava/lang/String;)Ljava/lang/Long;

    move-result-object v0

    invoke-virtual {v0}, Ljava/lang/Long;->longValue()J

    move-result-wide v0

    iput-wide v0, p0, Lcom/qiniu/resumableio/PutRet;->crc32:J

    .line 21
    const-string v0, "checksum"

    const-string v1, ""

    invoke-virtual {p1, v0, v1}, Lorg/json/JSONObject;->optString(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;

    move-result-object v0

    iput-object v0, p0, Lcom/qiniu/resumableio/PutRet;->checksum:Ljava/lang/String;

    .line 22
    const-string v0, "offset"

    const/4 v1, 0x0

    invoke-virtual {p1, v0, v1}, Lorg/json/JSONObject;->optInt(Ljava/lang/String;I)I

    move-result v0

    iput v0, p0, Lcom/qiniu/resumableio/PutRet;->offset:I

    .line 23
    return-object p0
.end method

.method public toJSON()Lorg/json/JSONObject;
    .registers 5
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Lorg/json/JSONException;
        }
    .end annotation

    .prologue
    .line 26
    new-instance v0, Lorg/json/JSONObject;

    invoke-direct {v0}, Lorg/json/JSONObject;-><init>()V

    .line 27
    .local v0, "json":Lorg/json/JSONObject;
    const-string v1, "crc32"

    iget-wide v2, p0, Lcom/qiniu/resumableio/PutRet;->crc32:J

    invoke-virtual {v0, v1, v2, v3}, Lorg/json/JSONObject;->put(Ljava/lang/String;J)Lorg/json/JSONObject;

    .line 28
    const-string v1, "checksum"

    iget-object v2, p0, Lcom/qiniu/resumableio/PutRet;->checksum:Ljava/lang/String;

    invoke-virtual {v0, v1, v2}, Lorg/json/JSONObject;->put(Ljava/lang/String;Ljava/lang/Object;)Lorg/json/JSONObject;

    .line 29
    const-string v1, "offset"

    iget v2, p0, Lcom/qiniu/resumableio/PutRet;->offset:I

    invoke-virtual {v0, v1, v2}, Lorg/json/JSONObject;->put(Ljava/lang/String;I)Lorg/json/JSONObject;

    .line 30
    const-string v1, "host"

    iget-object v2, p0, Lcom/qiniu/resumableio/PutRet;->host:Ljava/lang/String;

    invoke-virtual {v0, v1, v2}, Lorg/json/JSONObject;->put(Ljava/lang/String;Ljava/lang/Object;)Lorg/json/JSONObject;

    .line 31
    const-string v1, "ctx"

    iget-object v2, p0, Lcom/qiniu/resumableio/PutRet;->ctx:Ljava/lang/String;

    invoke-virtual {v0, v1, v2}, Lorg/json/JSONObject;->put(Ljava/lang/String;Ljava/lang/Object;)Lorg/json/JSONObject;

    .line 32
    return-object v0
.end method
